﻿<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/comm :: common-head"></head>
<body>
<div class="wrapper">
    <header th:replace="common/comm :: common-header"></header>
    <!-- 主体start -->
    <div class="main-panel">
        <div class="content">
            <div class="card">
                <div class="card-header">
                    <div class="card-title">
                        <span th:if="${alter == 'add'}">薪酬标准登记</span>
                        <span th:if="${alter == 'up'}">薪酬标准变更</span>
                    </div>
                </div>
                <div class="card-body">
                    <form th:action="${'/salaryStandard/saveAddOrUp/'+alter}" method="post"
                          id="auSalaryStandard">
                        <input type="hidden" name="id" th:value="${salaryStandard.id}">
                        <input th:if="${salaryStandard.auditStatus == null || salaryStandard.auditStatus == 12
                        || salaryStandard.auditStatus == 8 || salaryStandard.auditStatus == 15
                         || salaryStandard.auditStatus == 11}"
                               type="hidden" th:name="auditStatus" id="auditStatus">
                        <div class="form-group" th:if="${alter == 'up'}">
                            <label for="squareInput">薪酬标准编码:</label>
                            <input type="text" class="form-control input-square" readonly="readonly"
                                   th:value="${salaryStandard.code}">
                        </div>
                        <div class="form-group">
                            <label for="squareInput">薪酬标准名称:</label>
                            <input type="text"
                                   id="nameAdd" class="form-control input-square"
                                   name="name" th:value="${salaryStandard.name}" th:default="0">
                        </div>
                        <div class="form-group">
                            <label for="squareInput">薪酬总额:</label>
                            <input type="text" class="form-control input-square" readonly="readonly"
                                   name="totalMoney" th:value="${salaryStandard.totalMoney}">
                        </div>
                        <div class="form-group">
                            <label for="squareInput">制定人:</label>
                            <input type="text" id="designer" class="form-control input-square"
                                   name="designer" th:value="${salaryStandard.designer}">
                        </div>
                        <div class="form-group">
                            <label for="squareInput">登记人:</label>
                            <input type="hidden" name="createdById" th:value="${salaryStandard.createdById}">
                            <input type="text" th:if="${alter == 'add'}" class="form-control input-square"
                                   readonly="readonly"
                                   th:value="${#session.getAttribute('userSession').userName}">
                            <input type="text" th:if="${alter == 'up'}" class="form-control input-square"
                                   readonly="readonly"
                                   th:value="${createdByName}">
                        </div>
                        <div class="form-group" th:if="${alter == 'up'}">
                            <label for="squareInput">登记时间:</label>
                            <input type="text" class="form-control input-square" readonly="readonly"
                                   th:value="${#dates.format(salaryStandard.createdDate,'yyyy-MM-dd')}">
                        </div>
                        <div th:if="${salaryStandard.auditStatus == 11}" class="form-group">
                            <label for="testrange"> 更改原因:&nbsp;&nbsp; </label>
                            <textarea class="form-control" rows="5" cols="105" name="reasons"
                                      th:text="${salaryStandard.reasons}"></textarea>
                            <small class="form-text text-muted"></small>
                        </div>
                        <div th:if="${salaryStandard.auditStatus == 12 || str == 'detail'}" class="form-group">
                            <label for="testrange"> 审核意见:&nbsp;&nbsp; </label>
                            <textarea class="form-control" rows="5" cols="105" name="auditOpinion"
                                      th:text="${salaryStandard.auditOpinion}"></textarea>
                            <small class="form-text text-muted"></small>
                        </div>
                        <div>
                            <table class="table table-striped mt-3">
                                <thead>
                                <tr>
                                    <td>薪酬项目名称</td>
                                    <td>金额</td>
                                </tr>
                                </thead>
                                <tbody>
                                <tr th:if="${alter == 'add'}" th:each="sal,iterStat:${salaryProList}">
                                    <td>
                                        <input type="hidden" th:name="|salProStenList[${iterStat.index}].salP|"
                                               th:value="${sal.id}">
                                        <span th:text="${sal.name}"></span>
                                    </td>
                                    <td th:name="proMoney_td">
                                        <input type="number" th:name="|salProStenList[${iterStat.index}].proMoney|"
                                               th:value="${0.00}" min="0">
                                    </td>
                                </tr>
                                <tr th:if="${alter == 'up'}" th:each="sal,iterStat:${salaryProList}">
                                    <td>
                                        <input type="hidden"
                                               th:name="|salProStenList[${iterStat.index}].id|"
                                               th:value="${sal.id}"><span
                                            th:text="${sal.name}"></span>
                                    </td>
                                    <td th:name="proMoney_td">
                                        <input type="number" th:name="|salProStenList[${iterStat.index}].proMoney|"
                                               th:value="${sal.proMoney}" min="0">
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <div th:if="${str != 'detail'}" class="form-group" style="text-align: center;">
                            <input th:if="${salaryStandard.auditStatus == null || salaryStandard.auditStatus == 8 || salaryStandard.auditStatus == 15}"
                                   type="submit" class="btn btn-success" value="保存"
                                   th:onclick="setAuditStatus(8)">&emsp;
                            <input th:if="${salaryStandard.auditStatus == null || salaryStandard.auditStatus == 8 || salaryStandard.auditStatus == 15}"
                                   type="submit" class="btn btn-success" value="提交审核"
                                   th:onclick="setAuditStatus(12)">
                            <input th:if="${salaryStandard.auditStatus == 11}" type="submit" class="btn btn-success"
                                   value="变更" th:onclick="setAuditStatus(12)">
                            <input th:if="${salaryStandard.auditStatus == 12}" type="submit" class="btn btn-success"
                                   value="审核通过" th:onclick="setAuditStatus(11)">&emsp;
                            <input th:if="${salaryStandard.auditStatus == 12}" type="submit" class="btn btn-success"
                                   value="驳回" th:onclick="setAuditStatus(15)">&emsp;
                            <input type="reset" class="btn btn-danger"
                                   value="重置">&emsp;
                            <input type="button"
                                   class="btn btn-danger" value="返回"
                                   onclick="javascript:window.history.back();">
                        </div>
                    </form>
                    <div th:if="${str == 'detail'}" class="form-group" style="text-align: center;">
                        <button class="btn btn-danger" onclick="javascript:window.history.back();">返回</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<footer th:replace="common/comm :: common-footer"></footer>
<script th:src="@{/js_hr/salary/salaryStandard.js}"></script>
<script th:inline="javascript">
    jQuery.noConflict(); // 让渡 $ 的使用权
    (function ($) {
        var str = [[${str}]];
        if (str == "detail") {
            $("input").attr("disabled", "true");
            $("textarea").attr("disabled", "true");
        }
    })(jQuery);
</script>
</body>
</html>
